package com.ebocy.hammer.core.util;

import java.util.HashMap;
import java.util.Map;

public class Util {
	/**
	 * Create a Map<String, Object> from passed nameX, valueX parameters
	 * @return The resulting Map
	 * @author HouQingrong
	 * @date 31 May, 2011
	 */
	public static Map<String, Object> toMap(String name1, Object value1)
	{
		Map<String, Object> fields = new HashMap<String, Object>(1);

		fields.put(name1, value1);
		return fields;
	}

	/**
	 * Create a Map<String, Object> from passed nameX, valueX parameters
	 * @return The resulting Map
	 */
	public static Map<String, Object> toMap(String name1, Object value1, String name2,
			Object value2)
	{
		Map<String, Object> fields = new HashMap<String, Object>(2);

		fields.put(name1, value1);
		fields.put(name2, value2);
		return fields;
	}

	/**
	 * Create a Map<String, Object> from passed nameX, valueX parameters
	 * @return The resulting Map
	 */
	public static Map<String, Object> toMap(String name1, Object value1, String name2,
			Object value2, String name3, Object value3)
	{
		Map<String, Object> fields = new HashMap<String, Object>(3);

		fields.put(name1, value1);
		fields.put(name2, value2);
		fields.put(name3, value3);
		return fields;
	}

	/**
	 * Create a Map<String, Object> from passed nameX, valueX parameters
	 * @return The resulting Map
	 */
	public static Map<String, Object> toMap(String name1, Object value1, String name2,
			Object value2, String name3, Object value3, String name4, Object value4)
	{
		Map<String, Object> fields = new HashMap<String, Object>(4);

		fields.put(name1, value1);
		fields.put(name2, value2);
		fields.put(name3, value3);
		fields.put(name4, value4);
		return fields;
	}

	/**
	 * Create a Map<String, Object> from passed nameX, valueX parameters
	 * @return The resulting Map
	 */
	public static Map<String, Object> toMap(String name1, Object value1, String name2,
			Object value2, String name3, Object value3, String name4, Object value4,
			String name5, Object value5)
	{
		Map<String, Object> fields = new HashMap<String, Object>();

		fields.put(name1, value1);
		fields.put(name2, value2);
		fields.put(name3, value3);
		fields.put(name4, value4);
		fields.put(name5, value5);
		return fields;
	}

	/**
	 * Create a Map<String, Object> from passed nameX, valueX parameters
	 * @return The resulting Map
	 */
	public static Map<String, Object> toMap(String name1, Object value1, String name2,
			Object value2, String name3, Object value3, String name4, Object value4,
			String name5, Object value5, String name6, Object value6)
	{
		Map<String, Object> fields = new HashMap<String, Object>();

		fields.put(name1, value1);
		fields.put(name2, value2);
		fields.put(name3, value3);
		fields.put(name4, value4);
		fields.put(name5, value5);
		fields.put(name6, value6);
		return fields;
	}

	/**
	 * Create a Map<String, Object> from passed nameX, valueX parameters
	 * @return The resulting Map
	 */
	public static Map<String, Object> toMap(String name1, Object value1, String name2,
			Object value2, String name3, Object value3, String name4, Object value4,
			String name5, Object value5, String name6, Object value6, String name7,
			Object value7)
	{
		Map<String, Object> fields = new HashMap<String, Object>();

		fields.put(name1, value1);
		fields.put(name2, value2);
		fields.put(name3, value3);
		fields.put(name4, value4);
		fields.put(name5, value5);
		fields.put(name6, value6);
		fields.put(name7, value7);
		return fields;
	}

	/**
	 * Create a Map<String, Object> from passed nameX, valueX parameters
	 * @return The resulting Map
	 */
	public static Map<String, Object> toMap(String name1, Object value1, String name2,
			Object value2, String name3, Object value3, String name4, Object value4,
			String name5, Object value5, String name6, Object value6, String name7,
			Object value7, String name8, Object value8)
	{
		Map<String, Object> fields = new HashMap<String, Object>();

		fields.put(name1, value1);
		fields.put(name2, value2);
		fields.put(name3, value3);
		fields.put(name4, value4);
		fields.put(name5, value5);
		fields.put(name6, value6);
		fields.put(name7, value7);
		fields.put(name8, value8);

		return fields;
	}
}
